/** init domain config */
import './utils/rem.js'
import './config'
import Vue from 'vue'
import App from './App.vue'
import Storage from 'vue-ls'
import router from './router'
import store from './store/'
import { VueAxios } from '@/utils/request'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.less' // or 'ant-design-vue/dist/antd.less'
import '@/assets/less/reset.less'
import '@/assets/less/font.less'
import '@/assets/less/components.less'
import '@/assets/less/common.less'
import '@/assets/less/custom.less'
import Vue2OrgTree from 'vue2-org-tree'
import 'vue2-org-tree/dist/style.css'

// import 'amfe-flexible'

import '@/permission' // permission control
import '@/utils/filter' // base filter
/*import '@babel/polyfill'*/
import {
  ACCESS_TOKEN,
  DEFAULT_COLOR,
  DEFAULT_COLOR_WEAK,
  SIDEBAR_TYPE,
  DEFAULT_FIXED_HEADER,
  DEFAULT_FIXED_HEADER_HIDDEN,
  DEFAULT_FIXED_SIDEMENU,
  DEFAULT_CONTENT_WIDTH_TYPE,
  DEFAULT_MULTI_PAGE,
} from '@/store/mutation-types'
import config from '@/defaultSettings'

import JDictSelectTag from './components/dict/index.js'
import hasPermission from '@/utils/hasPermission'
import JeecgComponents from '@/components/jeecg/index'
import '@/components/jeecg/JVxeTable/install'
import '@/assets/iconfont/iconfont.css'
import 'viewerjs/dist/viewer.css'
import VueViewer from 'v-viewer'

import 'element-ui/lib/theme-chalk/index.css'
import { TimePicker } from 'element-ui'

// 将自动注册所有组件为全局组件
import dataV from '@jiaminghi/data-view'
import moment from 'moment'
Vue.prototype.$moment = moment
Vue.use(VueViewer)

import gsap from 'gsap'
import { OFFICIAL_DOCUMENT_MANAGEMENT_PARAMS, USER_INFO } from './store/mutation-types.js'
Vue.prototype.$gsap = gsap
Vue.use(dataV)
Vue.config.productionTip = false
Vue.use(Storage, {
  namespace: 'pro__', // key prefix
  name: 'ls', // name variable Vue.[ls] or this.[$ls],
  storage: 'local', // storage name session, local, memory
})
Vue.use(Antd)
Vue.use(VueAxios, router)
Vue.use(hasPermission)
Vue.use(JDictSelectTag)
Vue.use(JeecgComponents)
Vue.use(Vue2OrgTree)
// Vue.use(addWatermark)
Vue.use(TimePicker)

new Vue({
  router,
  store,
  mounted() {
    store.commit('SET_SIDEBAR_TYPE', Vue.ls.get(SIDEBAR_TYPE, true))
    store.commit('TOGGLE_FIXED_HEADER', Vue.ls.get(DEFAULT_FIXED_HEADER, config.fixedHeader))
    store.commit('TOGGLE_FIXED_SIDERBAR', Vue.ls.get(DEFAULT_FIXED_SIDEMENU, config.fixSiderbar))
    store.commit('TOGGLE_CONTENT_WIDTH', Vue.ls.get(DEFAULT_CONTENT_WIDTH_TYPE, config.contentWidth))
    store.commit('TOGGLE_FIXED_HEADER_HIDDEN', Vue.ls.get(DEFAULT_FIXED_HEADER_HIDDEN, config.autoHideHeader))
    store.commit('TOGGLE_WEAK', Vue.ls.get(DEFAULT_COLOR_WEAK, config.colorWeak))
    store.commit('TOGGLE_COLOR', Vue.ls.get(DEFAULT_COLOR, config.primaryColor))
    store.commit('SET_TOKEN', Vue.ls.get(ACCESS_TOKEN))
    store.commit('SET_MULTI_PAGE', Vue.ls.get(DEFAULT_MULTI_PAGE, config.multipage))
    store.commit(OFFICIAL_DOCUMENT_MANAGEMENT_PARAMS, Vue.ls.get(OFFICIAL_DOCUMENT_MANAGEMENT_PARAMS, {}))
    store.commit('SET_INFO', Vue.ls.get(USER_INFO), {})
  },
  render: (h) => h(App),
}).$mount('#app')
